// Priority Encoder

// *** OUT1
// DARK BLUE
// COUNTING
r1 exactly 1
srpR_gfp exactly 1
t1 exactly 1

// POSITIONING
r1 before srpR_gfp
r1 nextto srpR_gfp
srpR_gfp before t1 
srpR_gfp nextto t1
			
// ORIENTATION
all_forward

// LIGHT BLUE
// COUNTING
r2 exactly 1
lmrA_gfp exactly 1
t2 exactly 1

// POSITIONING
r2 before lmrA_gfp
r2 nextto lmrA_gfp
lmrA_gfp before t2 
lmrA_gfp nextto t2
			
// ORIENTATION
all_forward

// out1 REPORTER
// COUNTING
rOut1 exactly 1
bfp exactly 1
tOut1 exactly 1

// POSITIONING
rOut1 before bfp
rOut1 nextto bfp
bfp before tOut1 
bfp nextto tOut1
			
// ORIENTATION
all_forward


// input promoters of dark-blue
// aTc -> pTetR -> srpR_gfp
pTetR exactly 1
aTc induces pTetR
pTetR nextto pBAD
// arabinose -> pBAD -> srpR_gfp
pBAD exactly 1
arabinose induces pBAD
pBAD nextto r1
// order of the promoters
pTetR before pBAD

// input promoters of light-blue
// srpR_gfp -> pSrpR -> lmrA_gfp 
//***MODIFICATION OF ITERATION 2
pSrpR_2 exactly 1         
//***MODIFICATION OF ITERATION2
srpR_gfp represses pSrpR_2      
pSrpR_2 nextto r2
// 0 -> p0 -> lmrA_gfp
//p0 exactly 1
//0 induces p0
//p0 nextto r2
// order of the promoters
//pSrpR_2 before p0

// input promoter of out1 reporter
// lmrA_gfp -> pLmrA -> cRFP 
pLmrA exactly 1
lmrA_gfp represses pLmrA
pLmrA nextto rOut1

// *** OUT0
// ORANGE
// COUNTING
r3 exactly 1
betI_gfp exactly 1
t3 exactly 1

// POSITIONING
r3 before betI_gfp
r3 nextto betI_gfp
betI_gfp before t3 
betI_gfp nextto t3
			
// ORIENTATION
all_forward

// LIGHT GREEN
// COUNTING
r4 exactly 1
phlF_gfp exactly 1
t4 exactly 1

// POSITIONING
r4 before phlF_gfp
r4 nextto phlF_gfp
phlF_gfp before t4 
phlF_gfp nextto t4
			
// ORIENTATION
all_forward

// DARK GREEN
// COUNTING
r5 exactly 1
Bm3RI_gfp exactly 1
t5 exactly 1

// POSITIONING
r5 before Bm3RI_gfp
r5 nextto Bm3RI_gfp
Bm3RI_gfp before t5 
Bm3RI_gfp nextto t5
			
// ORIENTATION
all_forward

// OUT0 REPORTER
// COUNTING
rOut0 exactly 1
rfp exactly 1
tOut0 exactly 1

// POSITIONING
rOut0 before rfp
rOut0 nextto rfp
rfp before tOut0 
rfp nextto tOut0
			
// ORIENTATION
all_forward


// NOTE:
// we have two pTetR promoters in the design
// i.e. we need to name them differently

// input promoters of orange
//   - aTc -> pTetR -> betI_gfp   
// (named pTetR_3 since it drives betI_gfp)
aTc induces pTetR_3
pTetR_3 exactly 1
pTetR_3 nextto r3 
//   - pSrpR -> betI_gfp
//***MODIFICATION OF ITERATION 2
pSrpR_3 exactly 1          
//***MODIFICATION OF ITERATION2
pSrpR_3 nextto pTetR_3      
// - positioning of the input promoters
pSrpR_3 before pTetR_3


// input promoters of light green
//   - aTc -> pTetR -> phlF_gfp
aTc induces pTetR_4
pTetR_4 exactly 1
pTetR_4 nextto pLacI
//   - IPTG -> pLacI -> phlF_gfp
IPTG induces pLacI
pLacI exactly 1
pLacI nextto r4
// - positioning of the input promoters
pTetR_4 before pLacI

// input promoters of dark green
//   - betI_gfp -> pBetI -> Bm3RI_gfp
betI_gfp represses pBetI
pBetI exactly 1
pBetI nextto pPhlF
//   - phlF_gfp -> pPhlF -> Bm3RI_gfp
phlF_gfp represses pPhlF
pPhlF exactly 1
pPhlF nextto r5
// - positioning of its input promoters
pBetI before pPhlF

// input promoters of out0 reporter
// Bm3RI_gfp -> pBm3RI -> cGFP
Bm3RI_gfp represses pBm3RI
pBm3RI exactly 1
pBm3RI nextto rOut0


// WIRING out1 AND out0 DEVICES
srpR_gfp represses pSrpR_3

// Narrow down more
startswith pTetR
endswith tOut1
